<template>
  <div class="home">
   
    <button @click="add">+</button>
    <button @click="addAsync">异步的+</button>
    {{ $store.state.num }}
    {{ $store.getters.numDouble }}
    <button @click="reduce">-</button>
    <el-button>anniu</el-button>
    <el-rate v-model="rate"></el-rate>
  </div>
</template>

<script>

export default {
  data () {
    return {
      title: "我是啊啊啊啊",
      rate: 3
    }
  },
  methods: {
    add () {
      this.$store.commit('addNum', 2)
    },
    addAsync () {
      // 提交action
      this.$store.dispatch('addNumAsync', 6)
    },
    reduce () {
      this.$store.commit('reduceNum', 3)
    }
  },
  mounted() {
    console.log(this.$store)
    
  }
}
</script>

<style lang="scss" scoped>
h1{
  color: red;
}
.home /deep/ .box{
  color: blue;
}
</style>
